<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0"/>
    <meta name="renderer" content="webkit">
    <title>NT ERP LOGIN</title>
    <meta name="keywords" content="NT NEXT TRADING INFOKIT EXBOM ERP"/>
    <meta name="description" content=""/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <script language="javascript" src="/static/Admin/webjs/jquery.min.js"></script>
    <script language="javascript" src="/static/Admin/webjs/jquery-ui.min.js"></script>
    <script language="javascript" src="/static/Admin/webjs/bootstrap.js"></script>
    <script language="javascript" src="/static/Admin/js/display.js"></script>

    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <link href="/static/Admin/css/fontawesome.min.css" rel="stylesheet">
    <link href="/static/Admin/css/default.css" rel="stylesheet">
    <link href="/static/Admin/css/ntStyle.css" rel="stylesheet">

    <style>
        body, html {
            height: 100vh;
            width: 100vw;
            margin: 0;
            padding: 0;
            border: 0;
            background-color: #333;
        }

        .container {
            display: flex;
            display: -webkit-flex; /* Safari */
            flex-direction: column;

            min-height: 100vh;
            min-width: 100%;
            margin: 0;
            padding: 0;
            border: 0;

        }

        #ntLoginBg {
            background-color: rgb(102, 102, 102);
            background-image: url("/static/Admin/img/login_bg_1920x1080.jpg");
            background-repeat: no-repeat;
            background-size: cover;
            flex: 1;

        }

        #ntLoginBox {
            width: 100%;
            margin-top: 15vh;

            display: flex;
            justify-content: center;
            align-items: center;
        }

        .langsctive {
            background: #337ab7;
            color: #fff !important;
        }

        .langsctive:hover {
            color: #000 !important;
        }
    </style>

</head>

<body>
<div class="container">
    <div class="head">
        <nav class="navbar navbar-inverse" role="navigation">
            <div class="container-fluid" style="padding-left:0;margin-left:0">
                <div class="navbar-header">
                    <a href="index.html"><img src="/static/Admin/img/nt_logo.png" width="178px" height="50px"
                                              border="0"/></a>
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#top-menu">
                        <span class="glyphicon glyphicon-th-list"></span>
                    </button>

                    <button type="button" class="navbar-toggle" id="nav-search">
                        <span class="glyphicon glyphicon-search"></span>
                    </button>
                </div>

                <div class="collapse navbar-collapse navbar-right" id="top-menu">
                    <ul class="nav navbar-nav">
                            <li class="dropdown"><a href="#" class="dropdown-toggle langshow" data-toggle="dropdown"><span>LANGUAGE </span>
                                <b
                                        class="caret"></b> </a>
                            <ul  class="dropdown-menu langul" style="padding:0;">
                                {volist name="langs" id="val"}
                                <li><a href="#" class="setLang langsctive" lang="{$val.code}">{$val.name}</a></li>
                                {/volist}
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>
    </div>

    <div class="silde" id="ntLoginBg">
        <div class="row" id="ntLoginBox">
            <div class=" col-lg-5 col-md-6 col-ms-8 col-xs-10">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">{:strtoupper(lang('admin_login'))}</h4>
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-md-12 column" id="msgdata">
                                <div class="alert alert-dismissable alert-danger" id="showMsg">
                                    <button type="button" class="close" data-dismiss="alert" >&times;</button>
                                    <p></p>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label>{:strtoupper(lang('account'))}</label>
                                    <input type="text" autofocus="autofocus" placeholder="{:lang('account')}" name="name" id="name" class="form-control">
                                </div>
                                <div class="form-group">
                                    <label>{:strtoupper(lang('password'))}</label>
                                    <input type="password" placeholder="{:lang('password')}" name="passwd" id="passwd"
                                           class="form-control">
                                </div>
                                {if condition="$admin_cache>=3"}
                                <div class="form-group">
                                    <label style="display:block;">{:strtoupper(lang('verification_code'))}</label>
                                    <input placeholder="{:lang('please_enter_verification_code')}" type="text" name="code" id="verify"
                                           class="form-control"
                                           style="width: 200px;display: inline-block;">
                                    <img style="width:170px;height: 35px; " src="{:captcha_src()}"
                                        id="verifycapt" alt="">
                                </div>
                                {/if}
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-6">
                                <input type="checkbox"> {:lang('remember_may_account')}
                            </div>
                            <div class="col-md-6 text-right">
                                <small class="gray" style="padding-right:2em">
                                </small>
                            </div>
                        </div>

                        <hr>
                        <div class="text-right">
                            <button type="button" id="submit" class="btn btn-primary"
                                    style="padding-left:4em;padding-right:4em">
                                <span class="fa fa-door-open"></span>{:strtoupper(lang('login'))}
                            </button>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
    <div class="footer"> 2019 COPYRIGHT NEXT TRADING</div>
</div>
</body>
</html>
<script>
    function change_mes_type(el,type){
        var classname
        switch(type){
            case 0:
            classname='alert alert-danger'
                break;
            case 1:
            classname='alert alert-success'
                break;
            case 2:
            classname='alert alert-warning'
                break;
            case 3:
            classname='alert alert-info'
                break;
        }
        $(el).attr('class',classname)
    }
    $(function () {
        function showMsg(msg) {
            $(".alert p").html(msg);
        }

        var iphttp = 'https://www.toolnb.com';
        var ip = localStorage.getItem('ip'), area = localStorage.getItem('area');
        if(!ip || !area){
            $.ajax({
                type: 'post',
                url: iphttp + '/Tools/Api/IP.html',
                success: function (res) {
                    var nip = res.data.ip;
                    //获取相关的地址
                    $.post(iphttp+'/Tools/Api/ipgetareainfo.html',{ip:nip},function (res) {
                        $(".gray").html(nip + ':' + res.data.area);
                        localStorage.setItem('ip',nip);
                        localStorage.setItem('area',res.data.area);
                    })
                }
            })
        }else {
            $(".gray").html(ip + ':' + area);
        }

        $('.close').click(function () {
            $('#msgdata').hide()
        })
        $('.setLang').click(function () {
            $.ajax({
                url: '/admin/api/lang?lang_type=' + $(this).attr('lang'),
                type: 'post',
                success: function (data) {
                    location.reload();
                }
            })
        });
        $('#submit').click(function () {
            $("#msgdata .alert").hide();
            var data = {
                "name": $('#name').val(),
                "passwd": $('#passwd').val(),
                "verify": $('#verify').val(),
            };
            $.ajax({
                "url": "{:url('login/login')}",
                "type": "post",
                "data": data,
                "dataType": "json",
                "success": function (res) {
                    res = JSON.parse(res)
                    if (res.status != 1) {
                        change_mes_type('.alert',res.status)
                        if (res.count == 3) {
                            //显示验证码
                            location.reload();
                        } else {
                            $('#msgdata .alert').show();
                            showMsg(res.msg);
                            verifycapt();
                            return;
                        }
                    } else {
                        location.href = "{:url('Index/index')}"
                    }
                }
            });
        });
    })
    //监听回车键提交
    $(function () {
        document.onkeydown = keyDownSearch;
        function keyDownSearch(e) {
            // 兼容FF和IE和Opera
            var theEvent = e || window.event;
            var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
            if (code == 13) {
                $('#submit').click();//具体处理函数
                return false;
            }
            return true;
        }
    });
    function getCookie(name)
    {
        var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
        if(arr=document.cookie.match(reg))
            return unescape(arr[2]);
        else
            return null;
    }
    function setLang(){
        $('.langul .langsctive').removeClass('langsctive')
        var lang=getCookie('think_var')
        $('.langul li a').each(function(){
            //点击的语言和系统的语言一样
            if($(this).attr('lang')==lang){
                $(this).addClass('langsctive')
                $('.langshow span').html($(this).html())
            }
        })
    }
    setLang()
    //点击图片
    $('#verifycapt').click(function () {
        verifycapt();
    })
    function verifycapt() {
        $('#verifycapt').attr('src',"{:captcha_src()}" + '?' + Math.random())
    }
</script>